import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Created With IntelliJ IDEA
 * Description:牛客网：首页 > 试题广场 > 旧键盘 (20)
 * <a href="https://www.nowcoder.com/questionTerminal/f88dafac00c8431fa363cd85a37c2d5e">...</a>
 * User: DELL
 * Data: 2023-02-20
 * Time: 23:46
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String inStr = scanner.nextLine();
        String outStr = scanner.nextLine();
        //使用HashSet来避免输出重复
        Set<Character> hashSet = new HashSet<>();
        int j = 0;
        for (int i = 0; i < inStr.length(); i++) {
            char ch = inStr.charAt(i);
            if (j >= outStr.length() || ch != outStr.charAt(j)) {
                ch = Character.toUpperCase(ch);
                if (!hashSet.contains(ch)) {
                    System.out.print(ch);
                    hashSet.add(ch);
                }
            } else {
                j++;
            }
        }
        System.out.println();
    }
}
